<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:63:"E:\laragon\www\jcgj/application/admin\view\authgroup\index.html";i:1556698136;s:59:"E:\laragon\www\jcgj\application\admin\view\common\head.html";i:1556002984;}*/ ?>
<!DOCTYPE html>
<html>
  
  <head>
    <meta charset="UTF-8">
    <title>聚财国际</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="/public/static/css/font.css"> 
	<link href="/favicon.ico" type="image/x-icon" rel="shortcut icon" /> 
    <link rel="stylesheet" href="/public/static/css/xadmin.css">
    <link href="/public/static/lib/layui/css/layui.css" rel="stylesheet">
    <script type="text/javascript" src="/public/static/js/jquery.min.js"></script>
    <script type="text/javascript" src="/public/static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/public/static/js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <script type="text/css">
      #fff{
        border: red solid 1px;
      }
    </script>
  </head>
  
<body>
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页</a>
        <a href="">演示</a>
        <a>
          <cite>角色列表</cite></a>
      </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
    <xblock>
        <button class="layui-btn" onclick="x_admin_show('添加角色','<?php echo url('admin/authgroup/jiaoseadd'); ?>')"><i class="layui-icon"></i>添加角色</button>
        <span class="x-right" style="line-height:40px">共有数据:条</span>
    </xblock>
    <table class="layui-table">
        <thead>
        <tr>
            <th>NO</th>
            <th>标题</th>
            <th>角色描述</th>
            <th>状态</th>
            <th >操作</th>
        </tr>
        </thead>
        <tbody>
        <?php if(is_array($jiao) || $jiao instanceof \think\Collection || $jiao instanceof \think\Paginator): $i = 0; $__LIST__ = $jiao;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$jiao): $mod = ($i % 2 );++$i;?>
        <tr>
            <td><?php echo $key+1; ?></td>
            <td><?php echo $jiao['jname']; ?></td>
            <td><?php echo $jiao['describe']; ?></td>
            <td><?php if($jiao['status']==1): ?>正常<?php else: ?>锁定<?php endif; ?></td>
            <?php if($jiao['id']!=1): ?>
            <td class="td-manage">
                <a title="编辑" onclick="banner_edit(this,'')" attr_id='<?php echo $jiao['id']; ?>' href="javascript:;">
                    <i class="layui-icon">&#xe642;</i>编辑
                </a>
                <?php if($jiao['status']==1): ?>
                <a title="禁用" onclick="member_jin(this,'<?php echo $jiao['id']; ?>')" attr_id='' href="javascript:;">
                    <i class="layui-icon">&#xe642;</i>禁用
                </a><?php else: ?>
                <a title="启用" onclick="member_qi(this,'<?php echo $jiao['id']; ?>')" attr_id='' href="javascript:;">
                    <i class="layui-icon">&#xe642;</i>启用
                </a><?php endif; ?>
                <a title="设置权限" onclick="banner_set(this)" attr_id='<?php echo $jiao['id']; ?>' href="javascript:;">
                    <i class="layui-icon">&#xe642;</i>设置权限
                </a>
            </td><?php else: ?>
            <td>
                <button class="layui-btn layui-btn-sm layui-btn-radius layui-btn-danger">超级管理员拥有最高权限</button>
            </td><?php endif; ?>
        </tr>
        <?php endforeach; endif; else: echo "" ;endif; ?>
        </tbody>
    </table>
    <!--<div class="page">-->
        <!--<div>-->
        <!--</div>-->
    <!--</div>-->

</div>
<script>
    layui.use('laydate', function(){
        var laydate = layui.laydate;

        //执行一个laydate实例
        laydate.render({
            elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#end' //指定元素
        });
    });
    //管理员禁用
    function member_jin(obj,id){
        //发异步删除数据
        $.ajax({
            url:"<?php echo URL('authgroup/jin'); ?>",
            data:{"id":id},
            type:"post",
            dataType:'json',
            success:function(msg){
                if(msg==1){
                    layer.msg("禁用成功！",{icon: 6},function () {
                        //获得frame索引
                        var index = parent.layer.getFrameIndex(window.name);
                        //关闭当前frame
                        parent.layer.close(index);
                        window.location.reload();//刷新父级窗口

                    });
                    return false;

                }else{
                    layer.msg("失败！",{icon: 5},function () {
                        // 获得frame索引
                        var index = parent.layer.getFrameIndex(window.name);
                        // 关闭当前frame
                        parent.layer.close(index);
                        window.location.reload();//刷新父级窗口
                    });
                    return false;
                }
            }
        })
        return false;
    }
    //管理员启用
    function member_qi(obj,id){
        //发异步删除数据
        $.ajax({
            url:"<?php echo URL('authgroup/qi'); ?>",
            data:{"id":id},
            type:"post",
            dataType:'json',
            success:function(msg){
                if(msg==1){
                    layer.msg("启用成功！",{icon: 6},function () {
                        //获得frame索引
                        var index = parent.layer.getFrameIndex(window.name);
                        //关闭当前frame
                        parent.layer.close(index);
                        window.location.reload();//刷新父级窗口

                    });
                    return false;

                }else{
                    layer.msg("失败！",{icon: 5},function () {
                        // 获得frame索引
                        var index = parent.layer.getFrameIndex(window.name);
                        // 关闭当前frame
                        window.location.reload();//刷新父级窗口
                    });
                    return false;
                }
            }
        })
    }
  
   /*角色-修改*/
	function banner_edit(obj){
				
				var mid=$(obj).attr('attr_id');
				var url='<?php echo URL('authgroup/update'); ?>?id='+mid;
				//alert(url);
				x_admin_show('修改用户',url) 
	
		}

   /*给角色设置权限*/
	function banner_set(obj){
			
				var mid=$(obj).attr('attr_id');
				//alert(mid);
				var url='<?php echo URL('authgroup/setquan'); ?>?id='+mid;
				//alert(url);
				x_admin_show('设置权限',url) 
		}
</script>

</body>

</html>